package com.luozongcong.demomqtt.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/*******************************************************************************************
 * 类描述：
 *
 * @author: Administrator
 * @date： 2022/4/1 21:14
 * @date： 2022年04月01日 21:14
 * file-system-demo
 * @version 1.0
 *
 *
 * Version    Date       ModifiedBy                 Content
 * -------- ---------    ----------         ------------------------
 * 1.0      2022/4/1       21:14
 * @Copyright: 2022 www.glywzn.cn Inc. All rights reserved..
 * @attention: 本内容仅限于xxxx内部传阅，禁止外泄以及用于其他的商业目的
 *******************************************************************************************
 */
@Configuration
@EnableSwagger2
@EnableKnife4j
public class SwaggerConfig2 {

    /**
     * http://127.0.0.1:9685/doc.html
     * @return
     */
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.luozongcong.demomqtt.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("springboot利用swagger构建api文档")
                .description("简单优雅的restful风格")
                .termsOfServiceUrl("https://gitee.com/Yimi178/projects")
                .contact(new Contact("Yimi.Guilin","https://gitee.com/Yimi178/projects","178216110@qq.com"))
                .version("1.0")
                .build();
    }
}